﻿using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using DaInterFace;
using DaInterFace.SYN;

namespace DaFunction.SYN
{
    internal class SYN : ISYN
    {
        public event SYNMessageHandler MessageEvent;

        public IDataBase Data { get { return data; } }
        public ISYNSerial Serial { get { return serial; } }
        public IConfig Config { get { return config; } }
        //public Dictionary<String, Dictionary<String, Dictionary<String, BaseInfo>>> BaseDictionary { get { return baseDictionary; } }

        private IDataBase data;
        private ISYNSerial serial;
        private IConfig config;
        //private Dictionary<String, Dictionary<String, Dictionary<String, BaseInfo>>> baseDictionary;
        private Dictionary<String, SYNRight> rights;

        public SYN(IDataBase data, IConfig config)
        {
            this.data = data;
            this.serial = new SYNSerial();
            this.config = new SYNConfig(config);

            this.rights = new Dictionary<String, SYNRight>();
            //this.baseDictionary = new Dictionary<String, Dictionary<String, Dictionary<String, BaseInfo>>>();
        }

        public void Message(MessageType type, String note)
        {
            Message(type, note, 0);
        }

        public void Message(MessageType type, String note, Double span)
        {
            if (MessageEvent != null)
            {
                MessageEvent.Invoke(type, note, span);
            }
        }
    }
}
